package com.hq.ims.data.entityenum;


import com.hq.web.penum.IBaseEnum;

/**
 * 公司等级
 * 备注: 每增加一个层级小于200的公司层级 需要维护地方:
 * 1.getUserAllowChoseCompanyList方法中根据层级获取用户可登录的公司
 * 2.配置文件中的company-level是否需要考虑添加
 */
public enum EnumCompanyLevel implements IBaseEnum {

    GeoLogical(99, "地质局", -1, 100, "局"),

    Bureau(100, "地质局队（院）", 99, 200, "队（院）"),

    BureauCompany(200, "总公司", 100, 300, "公司"),

    BureauSubsidiary(300, "子公司", 200, 400, "公司"),

    ThirdParty(400, "分包", -1, -1, "分包"),

    Project(500, "项目部", -1, -1, "项目"),

    ;


    private final int code;
    private final String typeName;
    private final int nextCode;
    private final int previousCode;
    private final String simpleAlias;
    EnumCompanyLevel(int code, String typeName, int previousCode, int nextCode, String simpleAlias) {
        this.code = code;
        this.typeName = typeName;
        this.previousCode = previousCode;
        this.nextCode = nextCode;
        this.simpleAlias = simpleAlias;
    }

    public static EnumCompanyLevel getByCode(int code) {
        for (EnumCompanyLevel value : values()) {
            if (value.getCode() == code) {
                return value;
            }
        }
        return null;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getValue() {
        return typeName;
    }

    public String getTypeName() {
        return typeName;
    }

    public int getNextCode() {
        return nextCode;
    }

    public int getPreviousCode() {
        return previousCode;
    }

    public String getSimpleAlias() {
        return simpleAlias;
    }

}
